<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="edge" />
<link rel="shortcut icon" href="/static/style/images/favicon.ico" />
<!-- [EasyUI] -->
<link id="easyuiTheme" rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.5.1/themes/gray/easyui.css" />
<link id="easyuiTheme" rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.5.1/themes/icon.css" />
<script type="text/javascript" src="/static/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/static/js/HhUtil.js?t=20170109"></script>
<!-- [扩展样式] -->
<link rel="stylesheet" type="text/css" href="/static/css/dreamlu.css" />
<link rel="stylesheet" type="text/css" href="/static/css/icommon.css" />
<link rel="stylesheet" type="text/css" href="/static/css/login.css" />
<!--<script type="text/javascript" src="static/js/login.js" charset="utf-8"></script>-->
<title>用户管理</title>
<script type="text/javascript">
    var dataGrid;
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }
    var type = getUrlParam('type');

    $(function () {

        //首次进入拉取
        dataGrid = $('#dataGrid').datagrid({
            url: '/pubconsultlist',
            method:'get',
            fit: true,
            striped: true,
            pagination: true,
            sortName: 'id',
            sortOrder: 'desc',
            rownumbers: true,
            singleSelect: true,
            idField: 'news_id',
            pageSize: 20,
            pageList: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
            columns: [[{
                width: '40%',
                title: '',
                hidden: true,
                field: 'id'
            }, {
                width: '10%',
                title: '手机号',
                field: 'phone',
                sortable: false
            }, {
                width: '10%',
                title: '城市',
                field: 'area',
                sortable: false
            },{
                width: '10%',
                title: '车型',
                field: 'car_type',
                sortable: false
            },{
                width: '10%',
                title: '姓名',
                field: 'name',
                sortable: false
            },{
                width: '10%',
                title: '联系方式',
                field: 'tel',
                sortable: false
            },{
                width: '10%',
                title: '地址',
                field: 'addr',
                sortable: false
            },{
                width: '30%',
                title: '内容',
                field: 'content',
                sortable: false
            },{
                width: '10%',
                title: '发布时间',
                field: 'add_time',
                sortable: false
            },
            ]],
        });
        });
        //新增用户
        function addFun() {
            location.href='/static/news/news_add.html?type='+type;
        }

        function news_to_circle(news_id, is_first) {
            $.ajax({
                method: "post",
                url: "/newstocircle",
                data: {
                    is_first: is_first,
                    news_id: news_id
                },
                success: function (data) {
                    if (data.code == "0") {
                        HdUtil.messager.slide(data.msg);
                        $("#dataGrid").datagrid("reload");
                    } else {
                        HdUtil.messager.error(data.msg);
                    }
                }
            })
        }

        //查看详情
        function search_detail(news_id) {
            location.href='/static/news/news_detail.html?news_id='+news_id+'&type='+type;
        }
        //删除
        function deleteFun(id) {
            $.messager.confirm(HdUtil.constant.CONFIRM, HdUtil.constant.DELETE_CONFIRM, function (r) {
                    if (r) {
                        $.ajax({
                            method: "post",
                            url: "/delnews",
                            data: {
                                news_id: id
                            },
                            success: function (data) {
                                if (data.code == "0") {
                                    HdUtil.messager.slide(HdUtil.constant.DELETE_SUCCESS);
                                    $("#dataGrid").datagrid("reload");
                                } else {
                                    HdUtil.messager.error(data.msg);
                                }
                            }
                        })
                    }
                });

        }

    </script>
</head>
<body class="easyui-layout" data-options="fit:true,border:false">
<div data-options="region:'north',border:false" style="height: 30px; overflow: hidden;background-color: #fff">

</div>
<div data-options="region:'center',border:false,title:''">
  <table id="dataGrid" data-options="fit:true,border:false">
  </table>
</div>
<div id="toolbar" style="display: none;"> <a onclick="addFun();" href="javascript:void(0);" class="easyui-linkbutton"
           data-options="plain:true,iconCls:'icon-add'">添加</a>
 </div>


</body>
</html>
